<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2022/1/19
 * Time: 9:19
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\api\model\mysql;

use app\common\model\TimeModel;

class MallCollect extends TimeModel
{
    /**
     * 根据用户唯一识别号和商品id查询是否收藏 存在则收藏
     * @param string $openid
     * @param int $goods_id
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getMallCollectByOpenidAndGoodsInfo(string $openid = '', int $goods_id = 0)
    {
        return $this->where('openid', $openid)
            ->where('goods_id', $goods_id)
            ->find();
    }
}